package com.dabai.sas.activitys;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.dabai.sas.BuildConfig;
import com.dabai.sas.R;
import com.dabai.sas.utils.DabaiUtils;
import com.drakeet.about.AbsAboutActivity;
import com.drakeet.about.Card;
import com.drakeet.about.Category;
import com.drakeet.about.Contributor;
import com.drakeet.about.License;
import com.drakeet.about.Recommendation;

import java.util.ArrayList;
import java.util.List;

public class AboutActivity extends AbsAboutActivity {

    @Override
    protected void onCreateHeader(@NonNull ImageView icon, @NonNull TextView slogan, @NonNull TextView version) {
        icon.setImageResource(R.mipmap.ic_launcher4);
        slogan.setText("极简应用套件");
        version.setText("ver." + BuildConfig.VERSION_NAME + "_" + BuildConfig.VERSION_CODE);

        version.setOnClickListener(v -> new DabaiUtils().toStore(getApplicationContext()));

    }

    @Override
    protected void onItemsCreated(@NonNull List<Object> items) {
        items.add(new Category("帮助"));
        items.add(new Card(getString(R.string.app_help)));
        items.add(new Category("反馈"));
        items.add(new License("极简应用社区", "兔小巢", "需要什么功能,请发布在社区", "https://support.qq.com/products/319062/"));

        items.add(new Category("开发者"));
        items.add(new Contributor(R.mipmap.ic_head1, "BAI", "开发 & 设计", "https://dabai2017.gitee.io/lead/"));

        items.add(new Category("独立开发的应用"));

        items.add(new Recommendation(
                0, "二维码工具 - QRTools",
                "http://image.coolapk.com/apk_logo/2019/0618/13/ic_launcher-233673-o_1ddkgoe49jnn16j54di6a421vq-uid-1049606@512x512.png",
                "com.dabai.qrtools",
                "简洁,高效的二维码工具",
                "https://www.coolapk.com/apk/com.dabai.qrtools",
                null,
                null, 7.6, false)
        );
        items.add(new Recommendation(
                0, "MarkdownQ",
                "http://image.coolapk.com/apk_logo/2019/0824/11/-33e5c97db7836184-240416-o_1dj0qqtl31lg31ohn13lcase1dosq-uid-1049606@1024x1024.png",
                "com.dabai.markdownq",
                "Markdown编辑预览工具",
                "https://www.coolapk.com/apk/com.dabai.markdownq",
                null,
                null, 7.5, false)
        );
        items.add(new Recommendation(
                0, "WiFi密码查看",
                "http://image.coolapk.com/apk_logo/2021/0323/18/IMG_20210323_184959-257433-o_1f1fbbgm410cqjce10e41sm413ptr-uid-1049606@500x500.png",
                "com.dabai.wifiseepass",
                "查看WiFi密码,以及多种备份恢复方式",
                "https://www.coolapk.com/apk/com.dabai.wifiseepass",
                null,
                null, 9.1, false)
        );
        items.add(new Recommendation(
                0, "机型更改",
                "http://image.coolapk.com/apk_logo/2019/0828/19/phone2-241250-o_1djbudo1t19cm1oav1l421iab50015-uid-1049606@128x128.png",
                "com.dabai.ChangeModel2",
                "更改手机型号的显示内容",
                "https://www.coolapk.com/apk/com.dabai.ChangeModel2",
                null,
                null, 7.9, false)
        );


        items.add(new Category("开源地址"));
        items.add(new License("极简应用套件", "BAI", License.APACHE_2, "https://gitee.com/dabai2017/minimalist-application-suite"));

        items.add(new Category("开源代码许可"));

        items.add(new License("material-components", "Google", License.APACHE_2, "https://github.com/material-components/material-components-android"));
        items.add(new License("AndroidX", "Google", License.APACHE_2, "https://github.com/androidx/androidx"));
        items.add(new License("DBTools", "BAI", License.APACHE_2, "*"));
        items.add(new License("markwon", "noties", License.APACHE_2, "io.noties.markwon"));
        items.add(new License("fastjson", "alibaba", License.APACHE_2, "com.alibaba:fastjson"));
        items.add(new License("jsonviewer", "yuyh", License.APACHE_2, "com.yuyh.json:jsonviewer"));
        items.add(new License("bugly", "tencent", License.APACHE_2, "com.tencent.bugly"));
        items.add(new License("rxpermissions", "tbruyelle", License.APACHE_2, "com.github.tbruyelle:rxpermissions"));
        items.add(new License("SmartRefreshLayout", "scwang", License.APACHE_2, "com.scwang.smartrefresh:SmartRefreshLayout"));
        items.add(new License("rxpermissions", "afollestad", License.APACHE_2, "com.afollestad.material-dialogs"));
        items.add(new License("android-pdf-viewer", "barteksc", License.APACHE_2, "com.github.barteksc:android-pdf-viewer"));
        items.add(new License("PhotoView", "chrisbanes", License.APACHE_2, "com.github.chrisbanes:PhotoView"));
        items.add(new License("glide", "bumptech", License.APACHE_2, "com.github.bumptech.glide"));
        items.add(new License("rxjava2", "reactivex", License.APACHE_2, "io.reactivex.rxjava2"));
        items.add(new License("about-page", "drakeet", License.APACHE_2, "https://github.com/drakeet/about-page"));
        items.add(new License("MultiType", "drakeet", License.APACHE_2, "https://github.com/drakeet/MultiType"));

    }
}